<?php

require_once ($cfgPaths['lib'].'cms/postprocessors/cmsPostProcessor_latex.o.inc.php');

class cmsPostProcessor_pdflatex extends cmsPostProcessor_latex
{
  function cmsPostProcessor_pdflatex ($conf)
  {
    parent::cmsPostProcessor_latex($conf);
  }
  
  function process ($str)
  {
    chdir($GLOBALS['cfgPaths']['cacheDir']);
    $fn = 'tmp'.$GLOBALS['doc_id'];
    $fp = fopen($fn.'.tex',"w");
    fputs($fp,$str);
    fclose($fp);
    exec('pdflatex '.$fn.'.tex');
    $file = join('',file($fn.'.pdf'));
    syn_unlink($fn.'.tex');
    syn_unlink($fn.'.aux');
    syn_unlink($fn.'.log');
    syn_unlink($fn.'.pdf');
    chdir('..');
    return $file;
  }
    
}


?>
